@isTest(SeeAllData=true)
public class IYPProductDiscountTest
{

public static testMethod void test3() 
    { 
        Opportunity o = new Opportunity();      
        o.RecordTypeId = RecordTypeHelper.GetRecordTypeId('Opportunity', 'Contract');      
        o.Name = 'Unit Test';      
        o.StageName ='Prospect Identified';
        o.Contract_Start_Date__c =Date.today();
        o.Contract_Termination_Date__c = Date.today()+2;        
        o.CloseDate = Date.today();
        o.amount= 500;
        o.LeadSource = 'Newspaper';
        insert o;   

   Pricebook2 s = [select id from Pricebook2 limit 1];    
    // create the product
    Product2 p1 = new Product2(
        name ='IYP',
        IsActive=true,
        Description='My Product',
        ProductCode='12345'
    );
    insert p1;       
   
    // create the pricebookentry
    PricebookEntry pbe1 = new PricebookEntry(
        Pricebook2Id=s.id,
        Product2Id=p1.id,
        UnitPrice=0.00,
        IsActive=true,
        UseStandardPrice=false
    );
    insert pbe1;   

   OpportunityLineItem oli = new OpportunityLineItem(); 
    oli.Quantity = 1;
    oli.TotalPrice = 1;
    oli.PricebookEntryId = pbe1.id;
    oli.OpportunityId = o.id;    
    insert oli;  
 Product2 p2 = new Product2(
        name ='PRINT',
        IsActive=true,
        Description='My Product2',
        ProductCode='123455'
    );
    insert p2;  
  PricebookEntry pbe2 = new PricebookEntry(
        Pricebook2Id=s.id,
        Product2Id=p2.id,
        UnitPrice=10.00,
        IsActive=true,
        UseStandardPrice=false
    );
    insert pbe2;    
     OpportunityLineItem oli2 = new OpportunityLineItem(); 
    oli2.Quantity = 1;
    oli2.TotalPrice = 1;
    oli2.PricebookEntryId = pbe2.id;
    oli2.OpportunityId = o.id;  
    try
    {
    insert oli2; 
    }
    catch(Exception ex)
    {}
    
        
    } 
}